package com.ibeeking.found.auth.api.feign;

import com.ibeeking.found.auth.api.common.dto.LoginCpUserDTO;
import com.ibeeking.found.auth.api.common.query.LogoutAuthQuery;
import com.ibeeking.found.auth.api.common.query.LoginAuthQuery;
import com.ibeeking.found.auth.api.feign.fallback.CpLoginFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author ibeeking
 */
@FeignClient(name = "base-upms-cp-server", contextId = "cpLoginClient", path = "/cp", fallbackFactory = CpLoginFallbackFactory.class, decode404 = true)
public interface CpLoginClient {

    /**
     * 会员查询
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryLoginCpUser")
    ResponseResult<LoginCpUserDTO> queryLoginCpUser(@RequestBody LoginAuthQuery query);

    /**
     * 会员退出登录
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/user/feign/v1/logout")
    ResponseResult<Boolean> logout(@RequestBody LogoutAuthQuery param);

    /**
     * 通过企微UserId查询登录会员
     * @param openId
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryUserByOpenId/{openId}")
    ResponseResult<LoginCpUserDTO> queryUserByOpenId(@PathVariable("openId") String openId);

    /**
     * 通过手机号查询
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/user/feign/v1/contact/queryUserByMobileOpenId")
    ResponseResult<LoginCpUserDTO> queryUserByMobileOpenId(@RequestBody LoginAuthQuery query);
}
